﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using ScrumTable.DL.Data.Common;
using ScrumTable.DL.Data.Generic.Cache;

#endregion

namespace ScrumTable.DL.Data.Generic.Services
{
    /// <summary>
    /// This class is used to save data in the current data driver.
    /// </summary>
    public interface IDataSaver
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Returns true if the async method should be used to synchronize the
        /// data with the back-end system.
        /// </summary>
        bool UseAsync { get; }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Synchronizes the changes in the business / data layer with the backend-system
        /// in the UI thread.
        /// </summary>
        /// <param name="dataContext">Specifies the data context which contains the underlying data driver root object.</param>
        /// <param name="changes">Specifies the changes to synchronize.</param>
        void SyncChanges(GenericDataContextBase dataContext, CacheDataChanges changes);

        /// <summary>
        /// Synchronizes the changes in the business / data layer with the backend-system
        /// a parallel thread.
        /// </summary>
        /// <param name="dataContext">Specifies the data context which contains the underlying data driver root object.</param>
        /// <param name="changes">Specifies the changes to synchronize.</param>
        void SyncChangesAsync(AsyncDataContextInfo dataContext, CacheDataChanges changes);

        #endregion

    }
}